#! /usr/bin/perl -w
# $Id: Form.pm,v 1.6 2004/04/23 07:45:11 g6 Exp $
package CGI::FOGE2::SecurityAgent;

#require 5.006;
use CGI::FOGE2::Tools;
use strict;

#use CGI::FOGE2;
use CGI qw/:standard/;
use POSIX qw(strftime);

our @ISA = ();

=head1 SecurityAgent 

=head1 DESCRIPTION

This is the module, responsible for all possible security checks about 
the user rights and all time restrictions.

=cut

sub new {
    my $proto = shift;
    my $class = ref($proto) || $proto;
    my %args = @_;

    my @mandatory_keys = ();

    my $self  =
    {
	superusers     => undef,
	users          => undef,
	user_rights    => undef,
	groups         => undef,
	group_rights   => undef,
	submit_date0   => undef,
	submit_date1   => undef,
	user           => CGI::remote_user(), # if .htaccess protection
	user_addr      => CGI::remote_addr()
    };

    foreach my $key (keys %args) {
        if (exists $self->{$key}) {
            $self->{$key} = $args{$key};
        } else {
	    die "Bad permission definitions!\n";
        }
    }

    foreach my $key (@mandatory_keys) {
        if (!defined $self->{$key}) {
            die "Incoherent permissions definition!\n";
        }
    }

#    my $ip = CGI::remote_addr();
#    my $user = CGI::remote_user(); # if .htaccess protection
#    my $usr_name = CGI::user_name(); # user is the same as user_name

    bless ($self, $class);
    return $self;

}

sub print {
    print "mqsdkfjqmsdkfjmqlsjkdfmqjksdfmjqsdfjqmlsdjkfmqksdjfm\n";
}

1
